libxl: Multi-device passthrough coldplug: do not wait for unstarted guest
authorIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 25 Feb 2011 17:15:20 +0000 (17:15 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 25 Feb 2011 17:15:20 +0000 (17:15 +0000)
commit70628d024da42eea2de68939743c2c00d3a95a7d
tree2bcfacc14175f4bd8f9e09f99c773ab63be255c5
parent67743d23a8c4585e41b73e9d93fd237d2fbe1236
libxl: Multi-device passthrough coldplug: do not wait for unstarted guest

When doing a PCI passthrough, the code checks to see whether there is
an existing backend directory in xenstore with a nonzero "num_devs".
If there isn't, it creates the backend directory with just the
required device.

If there is, it would assume that it was doing hotplug.  If doing
hotplug, it needs to set the "state" node in xenstore to "7"
(reconfiguring) and thus avoid racing with the backend needs to wait
for the backend to be "4" (connected).

However during guest creation, the presence of "num_devs" doesn't
necessarily mean hotplug.  If we are still creating the initial
xenstore setup (ie, adding devices as a subroutine of domain
creation), we can just write the new devices to xenstore.  So do that.

This involves adding a new parameter "starting", indicating that we
are still in domain creation, to libxl_device_pci_add_xenstore (a
misnamed internal function) and its callers.  Its callers include
libxl_device_pci_add which we therefore split into an internal version
with the new parameter, and an external version used only for hotplug
by libxl-using applications.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/libxl_create.c
tools/libxl/libxl_internal.h
tools/libxl/libxl_pci.c